var currentZoomLevel;

/*
 function change DOI of elements
*/
function setDOI(e) {
	currentZoomLevel = $(e.tile.element);
}



/*
	Function for handling color interface in nics.html	 
*/
function setTextColor(color, enabled) {
  $(currentZoomLevel).find('text.point_label').each(function(){  		   		
   var c = $(this).css('fill');
   console.log(c);
   if(enabled) {
   	if(c == color)$(this).css('fill-opacity', 1.0);
   } else {
   	if(c == color)$(this).css('fill-opacity', 0.0);
   }
 })
 $(currentZoomLevel).find('text.text-collapse-group').each(function(){  		   		
   var c = $(this).css('fill');
   if(enabled) {
   	$(this).prev().css('display','block');
   	if(c == color) $(this).css('display', 'block');
   } else {
   	$(this).prev().css('display','none');
   	if(c == color) $(this).css('display', 'none');
   }
 })	 
}


/*
	TODO: Update the DOI function using the provided text. May need to call a
	function from text-collapse to update what's collapsed.
*/
function displayTextSearch(text, event) {
  $('text.point_label').each(function(){
	if (($(this).text()).indexOf(text) == -1) {
		$(this).css('fill-opacity', 0.0);
	}
  })		
}
